#ifndef SINGLETON
#define SINGLETON

template<typename T>
class Singleton
{
protected:
    static T* _InstObject;

    Singleton() {}
    virtual ~Singleton() {}

public:
    static T* getInstance()
    {
        if (_InstObject == nullptr)
        {
            _InstObject = new T();
        }
        return _InstObject;
    }

    static void Destroy()
    {
        if (_InstObject != nullptr)
        {
            delete _InstObject;
        }
        _InstObject = nullptr;
    }

    virtual bool Initialize() { return true; }

private:
    Singleton(const Singleton &s);
    Singleton& operator=(const Singleton &s);
};

template<typename T> T* Singleton<T>::_InstObject = nullptr;

#endif